﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Tester
{
    class Program
    {
        static void Main(string[] args)
        {
            //string expr = "[x] + [y] + AVERAGE([x],[y])";

            //var e = new Expression(expr);

            //e.GetParameters();

            //e.Parameters["x"] = 4;
            //e.Parameters["y"] = 6;
            //e.EvaluateFunction += new EvaluateFunctionHandler(e_EvaluateFunction);


            //Console.Out.WriteLine("Expression: " + expr);
            //Console.Out.WriteLine("Parameters: " + String.Concat(e.GetParameters()));
            //Console.Out.WriteLine("Evaluated: " + e.Evaluate());


            string expr = "AVERAGE(A1,A2)";

            //var e = new Expression(expr);

            //e.GetParameters();

            //e.ReferenceValues["A1"] = 1;
            //e.ReferenceValues["A2"] = 1;
            //e.ReferenceValues["A3"] = 1;
            //e.ReferenceValues["A5"] = 1;
            //e.EvaluateFunction += new EvaluateFunctionHandler(e_EvaluateFunction);
            //e.EvaluateFunction += new EvaluateFunctionHandler(e_EvaluateFunction2);


            Console.Out.WriteLine("Expression: " + expr);
            //Console.Out.WriteLine("Parameters: " + String.Concat(e.GetParameters()));
            //Console.Out.WriteLine("Parameter ranges: " + String.Concat(e.GetParameterRanges()));
            //Console.Out.WriteLine("Evaluated: " + e.Evaluate());

        }

        static double Average(IList<object> numbers)
        {
            double result = 0;
            foreach (var number in numbers)
            {
                result += Convert.ToDouble(number);
            }
            return result / numbers.Count;
        }
    }
}
